<%@ page contentType="text/html; charset=UTF-8"   pageEncoding="UTF-8"%>
<%@ taglib  uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib  uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib  uri="http://www.springframework.org/security/tags" prefix="sec" %>
<%@ taglib  uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib  uri="http://www.joda.org/joda/time/tags" prefix="joda" %>
<!DOCTYPE html>
<html>
<head>
<%@ include file="../../jsp/commons/headfiles-jquery.jsp" %>
<script type="text/javascript">
   var sbase = '${sbase}';
</script>
<link rel="stylesheet" type="text/css" media="screen" href="../css/apps/report/show.css" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>${bean.department.name} 军品快报</title>
<script type="text/javascript">
	var deptid = '${loginUser.department.id}';
	var method = '${param.operation}'||'update';
	var itemIndex = 0 || ${fn:length(bean.armItems)};
</script>
</head>
<body>
<div class="navbar navbar-fixed-top navbar-inverse">
		<div class="navbar-inner">
			<div class="container-fluid">
				<div class="nav-collapse">
					<a class="brand" href="#">生产月快表</a>
					<button class="btn btn-primary" id="saveBtn" type="button">
						<i class="icon-ok-sign"></i>保存
					</button>					
					<button class="btn btn-success" id="downloadBtn" type="button">
						<i class="icon-arrow-down"></i>下载
					</button>
                    <c:if test="${ not empty bean.id}">
                        <button type="button" class="btn btn-info" onclick="submitfor('${bean.id}',true)" >定值</button>
					</c:if>
					<button class="btn btn-warning" 	id="newPdt" type="button">添加产品</button>					
				
					<div class="pull-right">
						<button class="btn btn-danger" type="button" onclick="closeMe();">
							<i class="icon-remove-sign"></i>关闭
						</button>
					</div>
				</div>
			</div>
		</div>
</div>

<form id="armform">
<c:if test="${ not empty bean.id }">
   <input type="hidden" id="bean.id" name="bean.id" value="${bean.id}" />
   <input type="hidden" id="bean.finished" name="bean.finished" value="${bean.finished}" />
   
</c:if>
<input type="hidden" id="bean.title" name="bean.title" />
<input type="hidden" id="bean.maker.username" name="bean.maker.username"	value="${empty bean.maker?loginUser.username:bean.maker.username}" />
<input type="hidden" name="bean.department.id" value="${not empty bean.department.id?bean.department.id:loginUser.department.id}"  />
<c:if test="${not empty bean.lastMonthReporter.id }">
   <input type="hidden" name="bean.lastMonthReporter.id" value="${bean.lastMonthReporter.id}"/>
</c:if>
	

<table id="itemlist" class="table table-condensed table-bordered table-hover " >
<caption class="tablecaption">月产量统计快报</caption>
<thead>	 
	 	<tr>
	    	<th width="300">代码</th>
			<th>名称</th>			
			<th>本月完成[值]</th>
			<th>本月累计</th>
			<th>本月缴库</th>
			<th>缴库累计</th>
			<th>备注</th>
			<th>管理</th>
		</tr>
		<tr>
		   <th>
		   日期:<input id="rdateString"
			name="bean.createDate" 
			readOnly="readonly"
			type="text"
			value="<joda:format value="${bean.createDate}" pattern="yyyy-MM-dd" />"  />
			
		   </th>
		   <th><span class="label">制表:${bean.maker.localName}</span>  </th>
		   <th></th>
		   <th></th>
		   <th></th>
		   <th></th>
		   <th></th>
		   <th></th>
		</tr>
		 <tr>
			<td>
			<span class="label label-important">本月产值:${bean.localMonthValue} </span>
			
			</td>
			
			<td colspan="2">
			<span class="label label-important">本月新品总产值:${bean.freshValue} </span>
			</td>
			
			<td colspan="2">
			<span class="label label-important">本月累计总产值:${bean.localMonthTotalValue} </span>
			
			</td>
			<td colspan="2">
			</td>
            <td></td>				 
				 
		</tr>
	</thead>
	<c:set var="armItems" value="${bean.classifiedItems['常规产品']}" />
	<tbody id="pdtBody">	
		
		<c:forEach items="${armItems}" var="aitem" varStatus="statu">
		 
			<tr id='amp${statu.index}'>
				<td>
				 <input type="hidden" name="bean.armItems[${statu.index}].host.code" value="${aitem.host.code}" />
				[${statu.index}]${aitem.host.code}
				</td>
			 <!-- 从左往右依次为 -->		
				<!-- 产品名称 -->	
				<td><label>${aitem.host.name}</label></td>				
				<!-- 产品本月完成数目 【产值】 -->
				<td>
				  
				<input class="number-field" type="text"
					name="bean.armItems[${statu.index}].dataItems['local'].atomValue"
					value="${aitem.dataItems['local'].atomValue}" />
					[
					  <span style="color:red;font-style:bold">
					  <fmt:formatNumber value="${aitem.dataItems['local'].atomValue*aitem.host.price}" pattern="0.0000"/>
					  </span>
					  ]
														
					</td>
				
				<!-- 本月累计【值】 -->	
				<td>
				<label>
				${aitem.dataItems['local'].accumulateValue}
				 
					 [<span style="color:red;font-weight:bolder">
					  <fmt:formatNumber value="${aitem.dataItems['local'].accumulateValue*aitem.host.price}" pattern="0.0000"/>
					  </span>]
					</label>
				   					
					</td>
			  
				
				<!-- 缴库【值】 -->	
				<td  ><input class="number-field" type="text"
					name="bean.armItems[${statu.index}].dataItems['submit'].atomValue"
					value="${aitem.dataItems['submit'].atomValue}" />
				</td>
				
				<td>${aitem.dataItems['submit'].accumulateValue}
				
				[<span style="color:red;font-weight:bolder">
					  <fmt:formatNumber value="${aitem.dataItems['submit'].accumulateValue*aitem.host.price}" pattern="0.0000"/>
					  </span>]
				</td>
				
				<!-- 产品本月备注 【值】 -->	
				<td  ><input				   
					name="bean.armItems[${statu.index}].remark"
					value="${aitem.remark }" />
					</td>
				<td><a	href='javascript:;' 
					    onclick="deleteRowById('amp${statu.index}')"
					    style="font-size:14px;font-weight:bold">					    
					    <img src="${sbase}images/removeme.gif" /></a>
					    
					    </td>
			</tr>
		</c:forEach>		
	</tbody>	
</table>
<table>
<tfoot>
	 
	</tfoot>
</table>
</form>
<script type="text/javascript" src="../scripts/apps/reporter/edit.js"></script>
<script type="text/javascript" src="../scripts/apps/armmonthreporter/edit.js"></script>
<script type="text/javascript" src="../scripts/apps/reporter/util.js"></script>
</body>
</html>
